﻿using System;
using System.Collections.Generic;
using ApplicationBoilerplate.DependencyInjection;
using MongoDB.Driver;

namespace mvcForum.MembershipProviderTest {

	public class MongoBuilder : IDependencyBuilder {

		public void Configure(IDependencyContainer container) {
			MongoConnection connection = MongoConnection.Create("User.MongoDB");

			MongoCollection<User> uColl = connection.GetCollection<User>();
			uColl.EnsureIndex(User.FieldNames.ApplicationName);
			uColl.EnsureIndex(User.FieldNames.ApplicationName, User.FieldNames.UpperUsername);
			uColl.EnsureIndex(User.FieldNames.ApplicationName, User.FieldNames.Email);
			uColl.EnsureIndex(User.FieldNames.ApplicationName, User.FieldNames.LastActivityDate);

			MongoCollection<Role> rColl = connection.GetCollection<Role>();
			rColl.EnsureIndex(Role.FieldNames.ApplicationName, Role.FieldNames.Name);
		}

		public void ValidateRequirements(IList<ApplicationRequirement> feedback) {
		}
	}
}
